package com.ruoyi.monitor.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.monitor.mapper.MonitorBasicImagesMapper;
import com.ruoyi.monitor.domain.MonitorBasicImages;
import com.ruoyi.monitor.service.IMonitorBasicImagesService;

/**
 * 监控基本图片Service业务层处理
 * 
 * @author wym
 * @date 2024-03-01
 */
@Service
public class MonitorBasicImagesServiceImpl implements IMonitorBasicImagesService 
{
    @Autowired
    private MonitorBasicImagesMapper monitorBasicImagesMapper;

    /**
     * 查询监控基本图片
     * 
     * @param id 监控基本图片主键
     * @return 监控基本图片
     */
    @Override
    public MonitorBasicImages selectMonitorBasicImagesById(Long id)
    {
        return monitorBasicImagesMapper.selectById(id);
    }

    /**
     * 查询监控基本图片列表
     * 
     * @param monitorBasicImages 监控基本图片
     * @return 监控基本图片
     */
    @Override
    public List<MonitorBasicImages> selectMonitorBasicImagesList(MonitorBasicImages monitorBasicImages)
    {
        Map<String, Object> params = monitorBasicImages.getParams();
        LambdaQueryWrapper<MonitorBasicImages> query = new LambdaQueryWrapper<>();

                    query.eq(monitorBasicImages.getAddressId() != null, MonitorBasicImages::getAddressId, monitorBasicImages.getAddressId());



        return monitorBasicImagesMapper.selectList(query);
    }

    /**
     * 新增监控基本图片
     * 
     * @param monitorBasicImages 监控基本图片
     * @return 结果
     */
    @Override
    public int insertMonitorBasicImages(MonitorBasicImages monitorBasicImages)
    {
        monitorBasicImages.setCreateTime(DateUtils.getNowDate());
        monitorBasicImages.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
        return monitorBasicImagesMapper.insert(monitorBasicImages);
    }

    /**
     * 修改监控基本图片
     * 
     * @param monitorBasicImages 监控基本图片
     * @return 结果
     */
    @Override
    public int updateMonitorBasicImages(MonitorBasicImages monitorBasicImages)
    {
        monitorBasicImages.setUpdateTime(DateUtils.getNowDate());
        monitorBasicImages.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
        return monitorBasicImagesMapper.updateById(monitorBasicImages);
    }

    /**
     * 批量删除监控基本图片
     * 
     * @param ids 需要删除的监控基本图片主键
     * @return 结果
     */
    @Override
    public int deleteMonitorBasicImagesByIds(Long[] ids)
    {

        return monitorBasicImagesMapper.deleteBatchIds(Arrays.asList(ids));
    }
    /**
     * 删除监控基本图片信息
     * 
     * @param id 监控基本图片主键
     * @return 结果
     */
    @Override
    public int deleteMonitorBasicImagesById(Long id)
    {

        return monitorBasicImagesMapper.deleteById(id);
    }
}
